package com.daimler.itffo.tables;

import com.daimler.itffo.uvs.kern.Baumuster;
import com.daimler.itffo.uvs.kern.Code;

public class V0BRB171Key implements Comparable<Object> {
	
	public static final String PKW = new String("0M");
	public static final String SMART = new String("0S");
	public static final String TRUCK = new String("1M");
	public static final String UNIMOG = new String("3M");
	public static final String VIANO = new String("5M");
	public static final String G_WAGEN = new String("6M");
	public static final String SPRINTER = new String("7M");
	public static final String VENEO = new String("8M");
	public static final String SO_LAND = new String("");
	public static final String HERST_GR = new String("");
	public static final String BAUM = new String("");
	public static final String AS_CODE = new String("");

	private String SoLand;
	private String HerstGR;
	private Baumuster baum;
	protected String b171baum;
	private Code AsCode;

	public int compareTo(Object o) {

		V0BRB171Key b171key = (V0BRB171Key) o;
		int result = 0;

		if (result == 0)
			result = b171key.getb171SoLand().compareTo(this.SoLand);
		if (result == 0)
			result = b171key.getb171baum().compareTo(this.b171baum);

		if (result == 0)
			result = b171key.getb171HerstGR().compareTo(this.HerstGR);

		if (result == 0)
			result = b171key.getb171AsCode().getCode().compareTo(
					this.AsCode.getCode());
		return result;
	}

	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((SoLand == null) ? 0 : SoLand.hashCode());
		result = PRIME * result + ((HerstGR == null) ? 0 : HerstGR.hashCode());
		result = PRIME * result + ((AsCode == null) ? 0 : AsCode.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final V0BRB171Key other = (V0BRB171Key) obj;
		if (SoLand == null) {
			if (other.SoLand != null)
				return false;
		} else if (!SoLand.equals(other.SoLand))
			return false;
		if (HerstGR == null) {
			if (other.HerstGR != null)
				return false;
		} else if (!HerstGR.equals(other.HerstGR))
			return false;
		if (AsCode == null) {
			if (other.AsCode != null)
				return false;
		} else if (!AsCode.equals(other.AsCode))
			return false;
		return true;
	}

	public V0BRB171Key(String soLand, String herstGR, Baumuster baum,
			Code asCode) {
		super();
		this.SoLand = soLand;
		this.HerstGR = herstGR;
		this.b171baum = baum.get6DigitsBaumusterWithoutDot();
		this.baum = baum;
		this.AsCode = asCode;
	}

	public V0BRB171Key(V0BRB171Key key) {
		super();
		this.SoLand = key.getb171SoLand();
		this.HerstGR = key.getb171HerstGR();
		this.baum = key.getb171Baum();
		this.AsCode = key.getb171AsCode();
	}

	public String getb171SoLand() {
		return SoLand;
	}

	public String getb171HerstGR() {
		return HerstGR;
	}

	public Baumuster getb171Baum() {
		return baum;
	}

	public Code getb171AsCode() {
		return AsCode;
	}

	public void group() {

		this.b171baum = this.baum.getBaureihe();
	}

	public String getb171baum() {
		return b171baum;
	}

}
